NAME := board_ok1061s

$(NAME)_MBINS_TYPE := kernel
$(NAME)_VERSION    := 1.0.0
$(NAME)_SUMMARY    := configuration for FORLINX FET1061-S board
MODULE             := 1061
HOST_ARCH          := Cortex-M7
HOST_MCU_FAMILY    := mcu_mimxrt106x

$(NAME)_COMPONENTS += $(HOST_MCU_FAMILY) kernel_init

CONFIG_SYSINFO_PRODUCT_MODEL := ALI_AOS_FET1061_S
CONFIG_SYSINFO_DEVICE_NAME   := FET1061

GLOBAL_DEFINES += SKIP_SYSCLK_INIT
GLOBAL_DEFINES += QSPI_BOOT
GLOBAL_DEFINES += XIP_EXTERNAL_FLASH=1
GLOBAL_DEFINES += XIP_BOOT_HEADER_ENABLE=1
GLOBAL_DEFINES += KV_CONFIG_TOTAL_SIZE=0x4000
GLOBAL_DEFINES += KV_CONFIG_BLOCK_SIZE_BITS=12

GLOBAL_CFLAGS += -DSYSINFO_PRODUCT_MODEL=\"$(CONFIG_SYSINFO_PRODUCT_MODEL)\"
GLOBAL_CFLAGS += -DSYSINFO_DEVICE_NAME=\"$(CONFIG_SYSINFO_DEVICE_NAME)\"
GLOBAL_CFLAGS += -DSYSINFO_ARCH=\"$(HOST_ARCH)\"
GLOBAL_CFLAGS += -DSYSINFO_MCU=\"$(HOST_MCU_FAMILY)\"
GLOBAL_CFLAGS += -DCPU_MIMXRT1061CVL5A
GLOBAL_CFLAGS += -DCONFIG_NO_TCPIP


GLOBAL_INCLUDES += board \
                   boot \
                   aos \
                   startup

$(NAME)_SOURCES := board/board.c                                 \
                   board/clock_config.c                          \
                   board/pin_mux.c                               \
                   board/flexspi_norflash.c                      \
                   boot/fsl_flexspi_nor_boot.c \
                   boot/evkmimxrt1060_flexspi_nor_config.c \
                   boot/evkmimxrt1060_sdram_ini_dcd.c \
                   aos/soc_init.c \
                   aos/board_partition.c \
                   startup/system_MIMXRT1061.c 

ifeq ($(COMPILER), armcc)
$(NAME)_SOURCES    += startup/keil/startup_MIMXRT1061.s
$(NAME)_LINK_FILES := startup/keil/startup_MIMXRT1061.o
GLOBAL_LDFLAGS += -L --remove --keep=*(.boot_hdr.ivt) --keep=*(.boot_hdr.boot_data) --keep=*(.boot_hdr.conf) --scatter=../../../../board/ok1061s/startup/keil/MIMXRT1061xxxxx_flexspi_nor.scf
else ifeq ($(COMPILER), iar)
$(NAME)_SOURCES    += startup/iar/startup_MIMXRT1061.s
GLOBAL_LDFLAGS += --config board/ok1052c/startup/keil/MIMXRT1061xxxxx_flexspi_nor.icf
else
GLOBAL_ASMFLAGS += -D__STARTUP_INITIALIZE_NONCACHEDATA
GLOBAL_ASMFLAGS += -D__STARTUP_CLEAR_BSS
$(NAME)_SOURCES    += startup/gcc/startup_MIMXRT1061.S
GLOBAL_LDFLAGS += -T board/ok1061s/startup/gcc/MIMXRT1061xxxxx_flexspi_nor.ld
endif

# Keil project support
$(NAME)_KEIL_VENDOR = NXP
$(NAME)_KEIL_DEVICE = MIMXRT1061CVL5A
